package com.hutao.manage;

import javax.servlet.MultipartConfigElement;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

import com.hutao.manage.datasource.DynamicDataSourceRegister;

@SpringBootApplication
@Import({ DynamicDataSourceRegister.class })
@MapperScan(basePackages = "com.hutao.manage.mapper")
public class SDMSApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {

		SpringApplication.run(SDMSApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(SDMSApplication.class);
	}
	
	
	
	
	
	
	

	/**
	 * 文件上传配置
	 */
	@Bean 
	public MultipartConfigElement multipartConfigElement() {
		MultipartConfigFactory factory = new MultipartConfigFactory();
		// 单个文件最大
		factory.setMaxFileSize("102400KB"); // KB,MB
		/// 设置总上传数据总大小
		factory.setMaxRequestSize("1024000KB");
		return factory.createMultipartConfig();
	}

}
